<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <title>Title</title>
    <style>
        .head {
            width: 100%;
            height: 90px;
            text-align: center;
        }

        .head span {
            width: 100%;
            font-size: 30px;
            font-weight: 700;
            color: #333333;
            line-height: 60px;
            letter-spacing: 0px;

        }

        body {
            font-family: SimSun;
        }

        .table-body {
            border: none;
        }

        .table-body td {
            border-style: dashed;
        }

        td {
            word-wrap: break-word;
            word-break: break-all;
        }

        .left {
            text-align: left;
        }

        .right {
            text-align: right;
        }

        .thin {
            display: inline-block;
            font-size: 16px;
            word-wrap: initial;
            word-break: keep-all;
            transform: scaleX(0.7);
            transform-origin: left center;
            text-align: center;
        }
    </style>
</head>

<body>
<#escape x as x?html>
<#assign thTotal=0.0>
<#assign kkTotal=0.0>
<#assign bhTotal=0.000000>
<#assign size=10>
<#if datas?exists>

<#--计算所有明细合计-----begin----->
<#assign thTotal=0.0>
<#assign kkTotal=0.0>
<#assign bhTotal=0.000000>
<#list 0 .. datas?size - 1 as i>
    <#assign data=datas[i]>
    <#if data.RejectQtyTU?exists>
        <#assign thTotal +=data.RejectQtyTU?number>
    </#if>

    <#if data.RtnDeductQtyTU?exists>
        <#assign kkTotal +=data.RtnDeductQtyTU?number>
    </#if>
</#list>

<#--计算所有明细合计-----=end=----->


<#assign page=(datas?size/size)?ceiling>
<#list 1..page as c>
<#if c*size gt datas?size>
    <#assign end=datas?size-1 />
<#else>
    <#assign end=c*size-1 />
</#if>


<div>
    <#if page=c>
    <div>
        <#else>
        <div style="page-break-after:always;">
            </#if>
            <table width="100%" border="0" cellspacing="0" cellpadding="3">
                <tr>
                    <td colspan="3" class="head" style="text-align: center"><span>采购退货单</span></td>
                </tr>
                <tr>
                    <td width="33%"><b style="font-size: 20px;margin: 0 10px;">退货单号:</b>${DocNo!}</td>
                    <td><span style="margin: 0 10px;">日期:</span>${BusinessDate!}</td>
                    <td><span style="margin: 0 10px;">币种:</span>${Currency!}</td>
                </tr>
                <tr>
                    <td width="34%"><span style="margin: 0 10px;">货主:</span>${OwnerOrg!}</td>
                    <td><span style="margin: 0 10px;">存储地点:</span>${WH!}</td>
                    <td><span style="margin: 0 10px;">库管员:</span>${WhMan!}</td>
                </tr>
            </table>
            <div>
                <table class="table-body" width="100%" border="1" cellspacing="0" cellpadding="0"
                       style="table-layout:fixed;text-align: center;">
                    <thead style="display:table-header-group;font-weight:bold">
                    <tr style="">
                        <td colspan="21">供应商</td>
                        <td colspan="79" class="left">${Supplier!}</td>
                    </tr>
                    <tr>
                        <td width="6%" colspan="6">行号</td>
                        <td width="15%" colspan="15">料号</td>
                        <td width="10%" colspan="10">物料名称</td>
                        <td width="20%" colspan="20">规格</td>
                        <td width="5%" colspan="5">单位</td>
                        <td width="12%" colspan="12">
                                            <span class="thin">
                                                退货总数量
                                            </span>
                        </td>
                        <td width="12%" colspan="12">
                                            <span class="thin" >
                                                退货补货数量
                                            </span>
                        </td>
                        <td width="12%" colspan="12">
                            <span class="thin" >退货扣款数量</span>
                        </td>
                        <td width="8%" colspan="8">行备注</td>
                    </tr>
                    </thead>

                    <#list (c-1) * size..end as i>
                        <#assign data=datas[i]>
                        <tr>
                            <td colspan="6" class="right">${data.DocLineNo!}</td>
                            <td colspan="15" class="left">${data.ItemInfo_ItemCode!}
                            </td>
                            <td colspan="10" class="left">${data.ItemInfo_ItemName!}
                            </td>
                            <td colspan="20" class="left">${data.SPECS!}</td>
                            <td colspan="5" class="left">${data.UOM!}</td>
                            <td colspan="12" class="right">${data.RejectQtyTU!}</td>
                            <td colspan="12" class="right">
                                ${bhTotal?string('0.000000')!}</td>
                            <td colspan="12" class="right">${data.RtnDeductQtyTU!}
                            </td>
                            <td colspan="8"></td>
                        </tr>
                    </#list>
                    <tr>
                        <td height="30px" colspan="56">本单合计</td>
                        <td colspan="12" class="right"><b>${thTotal?string('0.000000')!}</b></td>
                        <td colspan="12" class="right"><b>${bhTotal?string('0.000000')!}</b></td>
                        <td colspan="12" class="right"><b>${kkTotal?string('0.000000')!}</b></td>
                        <td colspan="8">——</td>
                    </tr>
                </table>
                <br />
                <table border="0" cellspacing="0" cellpadding="-30">
                    <tr>
                        <td width="8%" style="padding-left: 20px;">审核日期:</td>
                        <td width="8%">${ApprovedOn!}</td>
                        <td width="8%">审核人:</td>
                        <td width="8%">${ApprovedBy!}</td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    </#list>
    </#if>
    </#escape>
</body>

</html>